<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>空气质量监测平台 - 登录</title>
    <style>
        .login-container { max-width: 400px; margin: 100px auto; padding: 20px; border: 1px solid #ddd; border-radius: 8px; }
        .form-group { margin-bottom: 15px; }
        input { width: 100%; padding: 8px; margin-top: 5px; border: 1px solid #ccc; border-radius: 4px; }
        .error { color: red; font-size: 0.9em; }
        button { width: 100%; padding: 10px; background: #4CAF50; color: white; border: none; border-radius: 4px; cursor: pointer; }
    </style>
</head>
<body>
    <div class="login-container">
        <h2>登录</h2>
        <form id="loginForm">
            <div class="form-group">
                <label>用户名</label>
                <input type="text" id="username" required>
                <div class="error" id="userError"></div>
            </div>
            <div class="form-group">
                <label>关注城市</label>
                <input type="text" id="city" placeholder="如：北京" required>
            </div>
            <div class="form-group">
                <label>密码</label>
                <input type="password" id="password" required>
                <div class="error" id="pwdError"></div>
            </div>
            <button type="submit">登录</button>
            <p style="margin-top:10px;">还没账号？<a href="javascript:showRegister()">注册</a></p>
        </form>

        <!-- 注册表单（默认隐藏） -->
        <form id="registerForm" style="display:none;">
            <h2>注册</h2>
            <div class="form-group">
                <label>用户名</label>
                <input type="text" id="regUser" required>
            </div>
            <div class="form-group">
                <label>关注城市</label>
                <input type="text" id="regCity" required>
            </div>
            <div class="form-group">
                <label>密码（≥6位）</label>
                <input type="password" id="regPwd" required>
            </div>
            <button type="submit">注册</button>
            <p style="margin-top:10px;">已有账号？<a href="javascript:showLogin()">登录</a></p>
        </form>
    </div>

    <script src="../scripts/user.js"></script>
</body>
</html>